 <?php
if($user->isAuthenticated() || isset($_GET['ui']))
{
    $user_id = '';
    if(isset($_GET['ui'])) $user_id = $_GET['ui'];
    else $user_id = $user->id;
    $query = sprintf("SELECT title, message, log_date, lat, lng FROM tbl_log_message WHERE user_id=%s", mysql_real_escape_string($user_id));
    $result = mysql_query($query);
    if (!$result) {
        $message  = 'Invalid query: ' . mysql_error() . "\n";
        $message .= 'Whole query: ' . $query;
        die($message);
    }
    while($row = mysql_fetch_array($result)){
        echo 'Add_Info_Window("'.$row['title'].'",Create_Log_Message("'.$row['title'].'", "'.$row['message'].'", "'.$row['log_date'].'"), new google.maps.LatLng('.$row['lat'].','.$row['lng'].'));';
    }
}
?>
